package com.netease.b.b.f;

import com.netease.a.b.h;
import com.netease.b.b.e.f;
import com.netease.b.b.e.g;
import com.netease.b.b.e.k;
import com.netease.framework.a.m;
import com.netease.pris.a.i;
import com.netease.pris.c.l;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.Hashtable;
import org.json.JSONException;
import org.json.JSONObject;

public class c extends k
{
  private static final String a = "/statuses/upload.json";
  private static final String b = "/statuses/update.json";
  private static final String j = "upload_image_url";
  private static final byte k = 1;
  private m A;
  private String B;
  private byte l = 0;
  private String m;
  private String n;
  private String o;
  private String p;
  private String q;
  private String z;

  protected c(int paramInt)
  {
    super(paramInt);
  }

  private m a(String paramString1, String paramString2, String paramString3, String paramString4)
  {
    Hashtable localHashtable = new Hashtable();
    String str = a.a().a("/statuses/update.json");
    localHashtable.put("status", paramString1);
    if (!com.netease.c.b.a(paramString2))
      localHashtable.put("lat", paramString2);
    if (!com.netease.c.b.a(paramString3))
      localHashtable.put("long", paramString3);
    if (!com.netease.c.b.a(paramString4))
      localHashtable.put("vid", paramString4);
    com.netease.c.b.c localc = a.a().b().a(com.netease.framework.a.b.b, str, localHashtable);
    localc.a(true);
    return localc;
  }

  public static com.netease.framework.b.a a(String paramString1, String paramString2, String paramString3, String paramString4, String paramString5, String paramString6)
  {
    c localc = new c(4097);
    localc.n = paramString3;
    localc.m = paramString2;
    localc.o = paramString4;
    localc.p = paramString5;
    localc.q = paramString6;
    localc.z = paramString1;
    return localc;
  }

  private void a(String paramString1, String paramString2)
  {
    a.a().a(paramString1, paramString2);
  }

  private boolean a()
  {
    int i = 1;
    String[] arrayOfString = l.c(com.netease.b.a.d.h().a(), this.z, i);
    if ((arrayOfString != null) && (arrayOfString.length == 2) && (!i.e(arrayOfString[0])) && (!i.e(arrayOfString[i])))
      a(arrayOfString[0], arrayOfString[i]);
    while (true)
    {
      return i;
      i = 0;
    }
  }

  private g b(String paramString)
  {
    Object localObject = null;
    g localg = new g(1);
    try
    {
      localg.a(com.netease.c.b.c(new JSONObject(paramString).optString("id")));
      if ((localg != null) && (i.e(localg.b())))
        return localObject;
    }
    catch (JSONException localJSONException)
    {
      while (true)
      {
        localJSONException.printStackTrace();
        localg = null;
        continue;
        localObject = localg;
      }
    }
  }

  private m c(String paramString)
  {
    com.netease.c.b.c localc = null;
    try
    {
      com.netease.a.b.b localb = new com.netease.a.b.b("pic", "upload.jpg", new File(paramString));
      com.netease.a.b.a[] arrayOfa = new com.netease.a.b.a[1];
      arrayOfa[0] = localb;
      h localh = new h(arrayOfa);
      localc = a.a().b().a(com.netease.framework.a.b.b, a.a().a("/statuses/upload.json"), null, localh);
      return localc;
    }
    catch (FileNotFoundException localFileNotFoundException)
    {
      while (true)
        localFileNotFoundException.printStackTrace();
    }
  }

  protected void a(int paramInt, Object paramObject)
  {
    super.a(paramInt, paramObject);
    if ((n() == 4097) && (this.l == 1))
      g().a(this);
    while (true)
    {
      return;
      h();
    }
  }

  public void a(int paramInt, String paramString)
  {
    f localf = a.a().a(paramInt, paramString);
    d(localf.h, localf);
  }

  public void a(String paramString)
  {
    Object localObject;
    switch (n())
    {
    default:
      localObject = null;
      if (o())
        break;
      if (localObject != null)
        c(0, localObject);
    case 4097:
    }
    while (true)
    {
      return;
      com.netease.g.b.e("BlogTransaction", paramString);
      if ((this.l == 0) && (!i.e(this.n)))
        try
        {
          this.B = com.netease.c.b.c(new JSONObject(paramString).optString("upload_image_url"));
          this.l = 1;
          if (this.B != null)
            continue;
          d(-3, null);
        }
        catch (JSONException localJSONException)
        {
          while (true)
            localJSONException.printStackTrace();
        }
      this.l = -1;
      localObject = b(paramString);
      break;
      d(-1, null);
    }
  }

  public void c()
  {
    if (!a())
    {
      d(-2, null);
      com.netease.g.b.d("***********", "Error  withou token & secret to send blog");
    }
    while (true)
    {
      return;
      switch (n())
      {
      default:
      case 4097:
      }
      while (true)
      {
        if ((this.A == null) || (o()))
          break label164;
        a(this.A);
        break;
        if ((this.l == 0) && (!i.e(this.n)))
        {
          this.A = c(this.n);
          continue;
        }
        String str = this.m;
        if (this.B != null)
          str = str + ' ' + this.B;
        this.A = a(str, this.o, this.p, this.q);
      }
      label164: d(-4, null);
      h();
    }
  }
}

/* Location:           D:\android\hack\dex2jar-0.0.9.8\classes_dex2jar.jar
 * Qualified Name:     com.netease.b.b.f.c
 * JD-Core Version:    0.6.0
 */